//
//  AccountFootView.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/11/2.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class AccountFootView: UIView {

    let addButton = UIButton()
    fileprivate let addImageView = UIImageView()
    fileprivate let addLabel = UILabel()
    fileprivate let tipLabel = UILabel()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.backgroundColor = UIColor.mineColor()
        
        addButton.backgroundColor = UIColor.red
        addButton.layer.cornerRadius = RATIO_H(maxNum: 22)
        addButton.layer.masksToBounds = true
        self.addSubview(addButton)
        
        addImageView.image = #imageLiteral(resourceName: "addhktx")
        addButton.addSubview(addImageView)
        
        addLabel.text = addBill
        addLabel.textColor = UIColor.white
        addLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 18))
        addButton.addSubview(addLabel)
        
        tipLabel.text = addBillTip
        tipLabel.textColor = UIColor.gray
        tipLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 14))
        self.addSubview(tipLabel)
        
        addButton.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(RATIO_H(maxNum: 20))
            make.left.equalToSuperview().offset(RATIO(maxNum: 20))
            make.right.equalToSuperview().offset(RATIO(maxNum: -20))
            make.height.equalTo(RATIO_H(maxNum: 44))
        }
        
        addLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.width.greaterThanOrEqualTo(10)
            make.height.greaterThanOrEqualTo(10)
            make.centerX.equalToSuperview().offset(RATIO(maxNum: 12))
        }
        
        addImageView.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.width.height.equalTo(RATIO_H(maxNum: 20))
        make.right.equalTo(addLabel.snp.left).offset(RATIO_H(maxNum: -4))
            
        }
        
        tipLabel.snp.makeConstraints { (make) in
            make.top.equalTo(addButton.snp.bottom).offset(RATIO_H(maxNum: 10))
            make.centerX.equalToSuperview()
            make.width.greaterThanOrEqualTo(10)
            make.height.equalTo(RATIO_H(maxNum: 20))
        }
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
